From 1081ca43b78bc7779337eb313edd84553a3cab24 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Mon, 25 Sep 2017 22:46:21 +0200 Subject: [PATCH] babl: set babl_rel_avg_error to a high value on NaN In relation to bug #787441, if the sum of errors contain a nan the sum is nan, we return pi as a much higher than expected average error to indicate that this is not 0.0. --- babl/babl-util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/babl/babl-util.c b/babl/babl-util.c index 9b08913..23c1513 100644 --- a/babl/babl-util.c +++ b/babl/babl-util.c @@ -91,10 +91,12 @@ babl_rel_avg_error (const double *imgA, for (i = 0; i < samples; i++) error += fabs (imgA[i] - imgB[i]); - if (error >= 0.000001) + if (error >= 0.0000001) error /= samples; - else + else if (error <= 0.0) error = 0.0; + else + error = M_PI; return error; } -- 2.30.2